﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using webapp4U.BOL;

namespace webapp4U.UI
{
    public partial class _Default : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            Load_Title();

            Pager.IndexChanged += new EventHandler(PageIndex_Changed);
            if (!Page.IsPostBack)
                this.DataBind();
        }

        private void PageIndex_Changed(Object sender, EventArgs e)
        {
            DataBind();
        }


        private void Load_Title()
        {
           TitleID.TitleName = ResourceManager.GetString("Bosuutap_Bosuutap");
        }

        public override void DataBind()
        {
            // hien thi bao nhieu hinh tren 1 trang
            Pager.PageSize = 12;

            List<Bosuutap> obj = Bosuutap.GetAllBosuutap(Pager.PageIndex, Pager.PageSize);
            ItemsDataList.DataSource = obj;
            ItemsDataList.DataBind();

            Pager.TotalRecords = Bosuutap.GetCountBosuutap();
                        
            // kiem tra xem co can hien thi phan trang ko
            if (Pager.TotalRecords <= 1)
                DisplayPager.Visible = false;
            else
                DisplayPager.Visible = true;
        }
        
    }
}